//
//  XHVisitorTableViewController.swift
//  gu-新浪微博
//
//  Created by xiaohui on 16/6/26.
//  Copyright © 2016年 gusheghui. All rights reserved.
//

import UIKit

class XHVisitorTableViewController: UITableViewController {

    var visitorView:XHVisitorView?
    
    //判断是否登录
    let isLogin:Bool = XHUserAccountTools.sharedTools.isLogin
    
    override func loadView() {
        if isLogin{
            super.loadView()
        }else{
         setUpVistorView()
        }
    }
   
    private func setUpVistorView(){
        setupNAav()
        visitorView = XHVisitorView()
        
        view = visitorView
        
        
    }
    
    //设置导航栏
    private func setupNAav(){
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", style: UIBarButtonItemStyle.Plain, target: self, action: "loginClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "loginClick")
        
    }
    
    @objc private func loginClick(){
    
        let vc = XHOAViewController()
        
        let nav = UINavigationController(rootViewController: vc)
        presentViewController(nav, animated: true, completion: nil)
        
        
        
    }
  
    override func viewDidLoad() {
        super.viewDidLoad()
  
    }
}
